import {ref} from 'vue'

// 发音全部逻辑
export const audioList = ()=>{

// 英式发音
 const riskSpreadRefList = ref([]);
 const getRiskSpreadRef = (el, index) => {
  if (el) {
    riskSpreadRefList.value[index] = el;
  }
};
 const clickAudio = (e) => {
  const ListIndex = ref(0);
  riskSpreadRefList.value.forEach((item, index) => {
    if (index === e) {
      // console.log(index);
      ListIndex.value = index
    }
  })
  riskSpreadRefList.value[ListIndex.value].play();
}

// 美式发音
const riskSpreadRefListM = ref([]);
 const getRiskSpreadRefM = (el, index) => {
  if (el) {
    riskSpreadRefListM.value[index] = el;
  }
};
 const clickAudioM = (e) => {
  const ListIndex = ref(0);
  riskSpreadRefListM.value.forEach((item, index) => {
    if (index === e) {
      // console.log(index);
      ListIndex.value = index
    }
  })
  riskSpreadRefListM.value[ListIndex.value].play();
}

// 将其全部导出
return{
  getRiskSpreadRef,
  clickAudio,
  getRiskSpreadRefM,
  clickAudioM
}
}


